package com.frost.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * Created by xulianquan on 2017/7/2.
 */
@Service
public class AsyncTaskService {
    @Async
    public void executeAsyncTask(int i) {
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("异步任务1：" + i+"；Thread.currentThread().getName():"+Thread.currentThread().getName());
    }

    @Async
    public void executeAsyncTask2(int i)  {
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("异步任务2：" + i+"；Thread.currentThread().getName():"+Thread.currentThread().getName());
    }
}
